package com.controller.setting;

import com.comm.R;
import com.comm.vo.ProjectTableVo;
import com.entity.DrugTable;
import com.entity.ProjectTable;
import com.service.setting.SystemProjecttableService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RequestMapping(value = "/setting/systemProject")
@Controller
@Api(value = "检查项目字典表test",tags = "检查项目字典表API")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=403,message="请求禁止"),
        @ApiResponse(code=401,message="请求未授权"),
        @ApiResponse(code=500,message="后台服务错误")})
public class SystemProject {

    @Autowired
    private SystemProjecttableService systemProjecttableService;
    //1.4.2：查找所有的检查项目字典表,且分页！！！
    @ResponseBody
    @RequestMapping(value ="/fundProject",method = RequestMethod.GET)
    @ApiOperation(value = "查找所有的检查项目字典表的接口",notes = "所有的检查项目字典表",httpMethod = "post", response = String.class)
    public  R fundProject(Integer currentPage , Integer pageSize){
        return systemProjecttableService.fundProjectTable(currentPage,pageSize);
    }
    //   1.4.3：添加检查项目字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/addProject",method = RequestMethod.POST)
    @ApiOperation(value = "添加检查项目字典表的接口",notes = "添加检查项目字典表",httpMethod = "post", response = String.class)
    @ApiImplicitParam(name = "projectName",value = "名称",required = true,dataType = "string",paramType = "query")
    public  R addProject(@RequestParam("projectName") String projectName){

        return systemProjecttableService.addProject(projectName);
    }
    // 1.4.4：编辑检查项目字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/editProject",method = RequestMethod.POST)
    @ApiOperation(value = "编辑检查项目字典表的接口",notes = "编辑检查项目字典表",httpMethod = "post", response = String.class)
    public  R editProject(@RequestBody @ApiParam(name = "实体类",value = "projectTable") ProjectTableVo projectTableVo){
        return systemProjecttableService.editProject(projectTableVo);
    }
    // 1.4.5：删除检查项目字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/delProject",method = RequestMethod.POST)
    @ApiOperation(value = "删除检查项目字典表的接口",notes = "检查项目字典表的接口",httpMethod = "post", response = String.class)
    @ApiImplicitParam(name = "id",value = "主键id",required = true,dataType = "int",paramType = "query")
    public  R delProject(@RequestParam(name = "id")Integer id){
        return systemProjecttableService.delProject(id);
    }
}
